package com.ynny.chapter14.controller;

import com.ynny.chapter14.bean.R;
import com.ynny.chapter14.bean.User;
import com.ynny.chapter14.mapper.UserMapper;
import com.ynny.chapter14.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

public class UserController {

    @Autowired
    UserService UserService;
    @Autowired
    UserMapper userMapper;

    @RequestMapping("/selectAll")
    public R selectAll(@RequestBody User user) {
        User user1 = UserService.selectIdAndNameAndPassword(user.getId(), user.getName(), user.getPassword());
        if (user1 != null) {
            return R.ok(user1);

        }
        return R.error(user1);

    }
}
